<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>

</html>

<script src="https://unpkg.com/vue/dist/vue.js"></script>

<script>
  new Vue({
    data: {

    },
    created() {
      //添加cookie
      let token = this.GetURLParameter("token");
      let name = this.GetURLParameter("name");
      this.setCookie("token", token);
      this.setCookie("name", name);
      top.location.href = "index.html";
    },
    methods: {
      GetURLParameter(sParam) {
        let sPageURL = window.location.search.substring(1);
        let sURLVariables = sPageURL.split("&");
        for (let i = 0; i < sURLVariables.length; i++) {
          let sParameterName = sURLVariables[i].split('=');
          if (sParameterName[0] == sParam) {
            return decodeURIComponent(sParameterName[1]);
          }
        }
      },
      setCookie(name, value) {
        document.cookie = name + "=" + value;
      },
      getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
          return unescape(arr[2]);

        } else {
          return null;
        }
      }

    }
  })
</script>